Skip to content

refactor(worker): Rework qworker teardown - #299

Merged
ketiltrout merged 2 commits into
chime-upgradefrom
rework_qworker_shutdown
Jul 22, 2026
Merged

refactor(worker): Rework qworker teardown#299
ketiltrout merged 2 commits into
chime-upgradefrom
rework_qworker_shutdown

Conversation

@ketiltrout

@ketiltrout ketiltrout commented Jul 16, 2026

Copy link
Copy Markdown
Member

Fixes for both normal and abnormal termination of the qworker process:

  • the worker will now always print exceptions that kill it
  • the worker won't try to kill Sanic if it was Sanic that killed it.
  • SIGINT and SIGTERM properly handled
  • Redis connection cleanly closed before exit

Also:

  • Moved the giant go function out of the function it was embedded in for better code legibility. (There are no code changes in the go function.)

I think this may be at least partially responsible for some of the spurious test failures in the CI

Fixes for both normal and abnormal termination of the qworker process:
* the worker will now always print exceptions that kill it
* the worker _won't_ try to kill Sanic if it was Sanic that killed _it_.
* SIGINT and SIGTERM properly handled
* Redis connection cleanly closed before exit

Also:
* Moved the giant `go` function out of the function it was embedded in
  for better code legibility.

@tristpinsm tristpinsm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did my best to work through the exit paths and I think it all makes sense!

Comment thread coco/worker.py Outdated
@ketiltrout
ketiltrout merged commit d235448 into chime-upgrade Jul 22, 2026
10 of 15 checks passed
@ketiltrout
ketiltrout deleted the rework_qworker_shutdown branch July 22, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants